<UserControl
    x:Class="ibba.src.noriskbo.SearchBar"    
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:sdk="http://schemas.microsoft.com/winfx/2006/xaml/presentation/sdk"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"    
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:local="clr-namespace:ibba.src.noriskbo" 
    xmlns:slr="clr-namespace:ibba.src.sl.recursos;assembly=ibba.src.sl.recursos"
    mc:Ignorable="d"
    d:DesignWidth="1024"
    FontSize="13.333">

    <UserControl.Resources>
        <local:SearchBarFontResultadoConverter x:Key="SearchBarFontResultadoConverter" />
        <local:SearchBarIconeVisivelConverter x:Key="SearchBarIconeVisivelConverter" />
    </UserControl.Resources>

    <Grid x:Name="LayoutRoot">
        <Border Height="40" VerticalAlignment="Top"
                Background="{StaticResource BlueStrong}" BorderThickness="1" BorderBrush="#FF393839">
            <Grid>
                <StackPanel Name="panelPesquisa"
                            Orientation="Horizontal" HorizontalAlignment="Left"
                            Margin="0">
                    <Grid>
                        <slr:AutoCompleteBoxFix x:Name="txtPesquisa"
                                             Margin="5,0,0,0" Height="28" MinWidth="500" Width="600"
                                             BorderBrush="#FF393839" FontSize="11"                                             
                                             ItemsSource="{Binding}"
                                             ValueMemberBinding="{Binding Path=Descricao}"
                                             MinimumPrefixLength="2" 
                                             KeyUp="txtPesquisa_KeyUp"
                                             GotFocus="txtPesquisa_GotFocus"
                                             LostFocus="txtPesquisa_LostFocus"> 
                            <sdk:AutoCompleteBox.ItemTemplate>
                                <DataTemplate>
                                    <StackPanel Orientation="Horizontal">
                                        <Grid Margin="5">
                                            <Image Source="{StaticResource IconeGrupo}" Height="20" 
                                                   Opacity="0.75" VerticalAlignment="Top" HorizontalAlignment="Left" />
                                            <Image Source="{StaticResource IconeCliente}" Height="20"
                                                   Opacity="0.75" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="5,15,0,0" 
                                                   Visibility="{Binding TipoResultado, Converter={StaticResource SearchBarIconeVisivelConverter}, ConverterParameter='C'}"/>
                                            <Image Source="{StaticResource IconeContrato}" Height="20"
                                                   Opacity="0.75" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="10,30,0,0" 
                                                   Visibility="{Binding TipoResultado, Converter={StaticResource SearchBarIconeVisivelConverter}, ConverterParameter='O'}"/>
                                        </Grid>

                                        <StackPanel Orientation="Vertical">
                                            <TextBlock Text="{Binding Path=NomeGrupo}" Margin="5,5,0,0"
                                                       FontWeight="{Binding TipoResultado, Converter={StaticResource SearchBarFontResultadoConverter}, ConverterParameter='G'}"/>

                                            <TextBlock Text="{Binding Path=NomeClienteCnpj}" Margin="5,5,0,0"
                                                       FontWeight="{Binding TipoResultado, Converter={StaticResource SearchBarFontResultadoConverter}, ConverterParameter='C'}"
                                                       Visibility="{Binding TipoResultado, Converter={StaticResource SearchBarIconeVisivelConverter}, ConverterParameter='C'}"/>

                                            <TextBlock Text="{Binding Path=Contrato}" Margin="5,5,0,5"
                                                       FontWeight="{Binding TipoResultado, Converter={StaticResource SearchBarFontResultadoConverter}, ConverterParameter='O'}"
                                                       Visibility="{Binding TipoResultado, Converter={StaticResource SearchBarIconeVisivelConverter}, ConverterParameter='O'}"/>
                                        </StackPanel>
                                    </StackPanel>
                                </DataTemplate>
                            </sdk:AutoCompleteBox.ItemTemplate>
                        </slr:AutoCompleteBoxFix>

                        <TextBlock Name="txtHelpPesquisa" Margin="10"
                                   FontSize="11" FontStyle="Italic" Foreground="#FF5A7194"
                                   MouseLeftButtonDown="txtHelpPesquisa_MouseLeftButtonDown" />
                    </Grid>

                    <Button Name="btnPesquisar" Margin="5,0,0,0" Height="28" BorderBrush="#FF393839" 
                            Click="btnPesquisar_Click">
                        <StackPanel Orientation="Horizontal" Margin="0,0,5,0">
                            <Image VerticalAlignment="Center" Source="{StaticResource BotaoPesquisar}" />
                            <TextBlock VerticalAlignment="Center" Text="Pesquisar" Margin="5,0,0,0" />
                        </StackPanel>
                    </Button>

                </StackPanel>

                <StackPanel Orientation="Horizontal" HorizontalAlignment="Right" Margin="0">
                    <Image Margin="0,-1,2,0" Source="{StaticResource LogoConfidencial}" Height="40" />
                </StackPanel>
            </Grid>
        </Border>
    </Grid>
</UserControl>